package com.ykdl.member.kid.beans;

import java.io.Serializable;

import org.json.JSONArray;
import org.json.JSONObject;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import net.wxxr.http.interfaces.IJsonParser;

public class ChatUpload  implements Serializable, IJsonParser{

	/**
	 * 
	 */
	private static final long serialVersionUID = 5766070335810603181L;
	private FileBean file;
	private int status;
	private String desc ;
	private String error ;
	public void setError(String error) {
		this.error = error;
	}
	public String getDesc() {
		return desc;
	}
	public String getError() {
		return error;
	}
	public FileBean getFile() {
		return file;
	}
	public int getStatus() {
		return status;
	}
	@Override
	public IJsonParser parse(String json) throws Exception {
		// TODO Auto-generated method stub
		Gson   gson = null;
		if(null != json){
			GsonBuilder b = new GsonBuilder();
			gson  = b.create();
//			final ChatUpload bean = new ChatUpload();
//			if("null".equals(json))return bean;
//			final JSONObject  object = new JSONObject(json);
//			if(json.startsWith("{") && json.endsWith("}")
//					&& object.has("status")
//					&& object.getInt("status") == -1){
//				bean.setError("错误");
//				return bean;
//			}
//			final String s = object.getString("file");
////			final JSONArray  imageArray= object.getJSONArray("file");
//			bean.setFilestring(s);
			return gson.fromJson(json, ChatUpload.class);
		}
		return null;
	}

}
